package com.foruo.learn.designmode.visitor;

/**
 * 女生买衣服裤子
 * @author GaoYuan
 * @date 2018/11/11 上午8:50
 */
public class WomanVisitor implements Visitor{

    @Override
    public void visit(Goods goods) {
        if(goods instanceof Clothes){
            if(((Clothes)goods).price > 500){
                System.out.println("[WomanVisitor]->" + ((Clothes)goods).goodsName + "：太贵了，不买");
            }else{
                System.out.println("[WomanVisitor]->" + ((Clothes)goods).goodsName + "：什么颜色都能接收，买了");
            }
        }else if(goods instanceof Trousers){
            if(((Trousers)goods).price > 500){
                System.out.println("[WomanVisitor]->" + ((Trousers)goods).goodsName + "：太贵了，不买");
            }else if(((Trousers)goods).getLength() > 8){
                System.out.println("[WomanVisitor]->" + ((Trousers)goods).goodsName + "：太长了，不买");
            }else{
                System.out.println("[WomanVisitor]->" + ((Trousers)goods).goodsName + "：裤子越短约好，买了");
            }
        }
    }
}
